/**
 * Created by plter on 2016/11/3.
 */

(function () {

    function Student(name, age, gender) {
        var self = {};

        self._name = name;
        self._age = age;
        self._gender = gender;

        self.sayHello = function () {
            console.log(self._name + " say hello");
        };

        self.sayHi = function () {
            console.log(self._name + " say hi");
        };

        return self;
    }

    function BoyStudent(name, age) {
        var self = Student(name, age, "男");

        self.sayHello = function () {
            console.log(`男学生${this._name}说你好`);
        };

        return self;
    }


    var s = Student("小丽", 12, "女");
    s.sayHello();

    var bs = BoyStudent("小明", 8);
    bs.sayHello();


})();